package ypmits.utils {
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.events.Event;

	/**
	 * @author Dave Lenz
	 */
	public class AView extends Sprite {

		protected var s : Stage;
		protected var sw : Number;
		protected var sh : Number;

		public function AView( stage : Stage, resizehandler : Boolean = false ) {
			s = stage;
			sw = stage.stageWidth;
			sh = stage.stageHeight;
			
			if( resizehandler ) s.addEventListener( Event.RESIZE, resizeHandler );
		}
		
		
		protected function resizeHandler( e : Event ) : void {
			sw = s.stageWidth;
			sh = s.stageHeight;
		}

		
		public function enable() : void 
		{
			mouseEnabled = mouseChildren = true;
		}
		
		
		
		public function disable() : void 
		{
			mouseEnabled = mouseChildren = false;
		}

		
		
		public function dispose() : void 
		{
			try {
				s.removeEventListener( Event.RESIZE, resizeHandler );
				parent.removeChild( this );
			} catch(e:*){}
		}
	}
}
